/// **************************************************************************************************
/// "Copyright (c) 2007 Sai Panyam, Inc.  All rights reserved."
/// **************************************************************************************************
/// Component Name   :	AttributeCollection, Member of System72.NTextile 
/// Description      :	AttributeCollection description
/// Author           :	Sai Panyam
/// Creation Date    :	November 09 2007
/// Modified Date    :              
/// Modified By      :
/// **************************************************************************************************
using System.Collections.Generic;

namespace System72.NTextile
{
    public class AttributeCollection:List<Attribute>
    {
        #region Private Variables

        private Attribute m_attributeToMatch;

        #endregion

        #region Public Methods
        /// <summary>
        /// 
        /// </summary>
        /// <param name="attribute"></param>
        /// <returns></returns>
        public bool ContainsAttribute(Attribute attribute)
        {
            if (attribute != null)
            {
                m_attributeToMatch = attribute;
                return Exists(attributeSearchPredicate);
            }
            else
            {
                return false;
            }
        }

        #endregion

        #region Private Method
        /// <summary>
        /// 
        /// </summary>
        /// <param name="matchAttribute"></param>
        /// <returns></returns>
        private bool attributeSearchPredicate(Attribute matchAttribute)
        {
            if (matchAttribute != null)
            {
                if (matchAttribute.AttributeType == m_attributeToMatch.AttributeType)
                {
                    return true;
                }
            }
            return false;
        }

        #endregion
    }
}
